package com.fight.strive.sys.modules.rbac.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fight.strive.sys.modules.common.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;


@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Entity
@Table(name = "t_sys_rbac_user_department",
        uniqueConstraints = {@UniqueConstraint(columnNames = {"userId", "departmentId"})},
        indexes = {
                @Index(columnList = "userId"),
                @Index(columnList = "departmentId")})
@TableName("t_sys_rbac_user_department")
public class RbacUserDepartmentEntity extends BaseEntity {

    /**
     * 用户ID
     */
    private Long userId;

    /**
     * 部门ID
     */
    private Long departmentId;

    /**
     * 部门职位
     */
    private String position;

    /**
     * 人员部门标记，1：主部门；0：非主部门
     * 主部门是长期稳定所在的部门，非主部门表示临时代理或临时处理某项事务时所在的部门
     */
    private Integer flag;
}
